using System;
using HCP.Responses;
using HCP.SimpleJSON;
using UnityEngine.SceneManagement;

namespace HCP.Requests
{
	public class LoadLevel : JobRequest
	{
		public LoadLevel(JSONClass json) : base(json)
		{
		}

		public string Name
		{
			get
			{
				return base.Data["name"];
			}
		}

		public string Index
		{
			get
			{
				return base.Data["index"];
			}
		}

		public override JobResponse Process()
		{
			if (!string.IsNullOrEmpty(this.Name))
			{
				SceneManager.LoadScene(this.Name);
			}
			else
			{
				SceneManager.LoadScene(this.Index);
			}
			return new StringResponse();
		}
	}
}
